import { RouteRecordRaw } from 'vue-router'
import Home from '@/views/Home.vue'
import Sign from '@/views/Sign.vue'
import Index from '@/views/Index.vue'
import Hot from '@/views/Hot.vue'
import Subject from '@/views/Subject.vue'
import Detailed from '@/views/Detailed.vue'
import CreateArticle from '@/views/Create-article.vue'
import User from '@/views/User.vue'

export const routerMap: RouteRecordRaw[] = [
    {
        path: '/',
        name: 'Home',
        component: Home,
        children: [
            {
                path: '/',
                name: 'Index',
                component: Index,
                meta: {
                    title: '首页',
                    isNav: true,
                    icon: 'home'
                }
            }, 
            {
                path: '/hot',
                name: 'Hot',
                component: Hot,
                meta: {
                    title: '热榜',
                    isNav: true,
                    icon: 'hot'
                }
            },
            {
                path: '/subject',
                name: 'Subject',
                component: Subject,
                meta: {
                    title: '话题',
                    isNav: true,
                    icon: 'subject'
                }
            },
            {
                path: '/d/:id',
                name: 'detailed',
                component: Detailed
            },
            {
                path: '/user',
                name: 'User',
                component: User,
                children: [
                    {
                        path: '/user/:id',
                        name: 'UserInfo',
                        component: () => import('@/components/user/user-info.vue'),
                        children: [
                            {
                                path: '/user/:id/:pageValue',
                                name: 'UserInfoTabs',
                                components: {
                                    article: () => import('@/components/user/info-page/article.vue'),
                                    dynamic: () => import('@/components/user/info-page/dynamic.vue'),
                                    collect: () => import('@/components/user/info-page/collect.vue'),
                                    follow: () => import('@/components/user/info-page/follow.vue'),
                                    following: () => import('@/components/user/info-page/following.vue')
                                }
                            }
                        ]
                    },
                    {
                        path: '/user/editor',
                        name: 'UserEditor',
                        component: () => import('@/components/user/user-editor.vue'),
                        children: [
                            {
                                path: '/user/editor/:pageValue',
                                name: 'UserEditorTabs',
                                components: {
                                    info: () => import('@/components/user/editor-page/info.vue'),
                                    account: () => import('@/components/user/editor-page/account.vue'),
                                    password: () => import('@/components/user/editor-page/password.vue'),
                                    privacy: () => import('@/components/user/editor-page/privacy.vue'),
                                    block: () => import('@/components/user/editor-page/block.vue')
                                }
                            }
                        ]
                    }
                ]
            }
        ]
    },
    {
        path: '/',
        name: 'Sign',
        component: Sign,
        children: [
            {
                path: '/sign-in',
                name: 'SignIn',
                component: () => import('@/components/sign/sign-in.vue')
            },
            {
                path: '/sign-up',
                name: 'SignUp',
                component: () => import('@/components/sign/sign-up.vue')
            },
            {
                path: '/reset-pwd',
                name: 'ResetPwd',
                component: () => import('@/components/sign/reset-pwd.vue')
            }
        ]
    },
    // {
    //     path: '/sign-in',
    //     name: 'Sign',
    //     // component: Sign,
    //     component: () => import('@/views/Sign.vue'),
    //     redirect: '/',
    //     children: [
    //         {
    //             redirect: '',
    //             path: '/sign-in',
    //             name: 'SignIn'
    //         },
    //         {
    //             redirect: '',
    //             path: '/sign-up',
    //             name: 'SignUp'
    //         },
    //         {
    //             redirect: '',
    //             path: '/reset-pwd',
    //             name: 'ResetPwd'
    //         }
    //     ]
    // },
    // {
    //     path: '/sing',
    //     name: 'Sign',
    //     component: () => import('@/views/Sign.vue'),
    // },
    {
        path: '/editor',
        name: 'CreateArticle',
        component: CreateArticle,
        children: [
            {
                path: '/editor',
                name: 'Editor',
                component: () => import('@/views/Editor.vue')
            },
            {
                path: '/md',
                name: 'Md',
                component: () => import('@/views/Md.vue')
            }
        ]
    }
]

export const whiteList: Array<string> = [
    '/login',
    '/404'
]